A whole lot of refactoring and hacking