Renamed functions and added comments