Renamed and re-organized some functions
Minor fixes