Heck of a lot of code clean up