Added comments to controller file to explain the basic mechanics