first working version
Added javadoc comments