Refactoring, moved a method to lib