Some problems with mixing up the branches. Added javadoc