Started refactoring Java code in scala