added comments to all functions in controller