Working on Cleaning up the code