Renamed functions, added heirarchy