Lots of code cleanup :)