WOW that's a lot of code cleanup