Done a bit of a refactor.