fully switch to java, add unit tests