Still working through cleaning the code