Rename some functions
Minor code changes