more javadocs and some package dependent refactoring