migrate some more stuff to java