completed adding functionality for the controller