Refactoring to be less shite.