More code refactoring
Code refactoring on java end