added update and edit functions to controller