#3 refactor before unit tests