Big clean up, mostly java fixes