I've tried to squash down the size of the diff to be merged by removing an unessesary refactoring)