Use the Java API a bit better.