Improve java API