Add comments and more javadoc