Renamed functions, clarified comments