several refactorings
add licences and some javadocs
Merge branch 'refactoring'