Finished pure Java portion