Improvements to Java code