Re-Organized some functions