A fair amount of code refactoring and cleaning