Refactoring out java classes