Masturbatory refactoring in progress, please avert your eyes.