Renamed functions and moved private declarations