added the missing functions from Amir