Small functional refactor