pure java refactoring