refactored some Java stuff