Added comments, javadoc etc.
merge