Renamed and restructured functions