tidy up main java file