Cleaning up the code, and fixing some naming convencions