Some refactoring, fixing busted test (oops hehe)