added funciton closing statments for ret/restore and defining size of function to save