Added update function to controller