First bit of refactoring done, now testing