edited and added some javadoc