Java mode
FIX tests and refactoring