revised and add javadocs