Cleaned up and Organized Code