more refactoring and javadoc cleanup
some last refactor and fixes to it - stuill needs to be tested