some comments and cleanup of java codegen