A bit of a refactor