Add update function to controller