Removed newJava function since it caused serialization issues