added javadoc and removed useless code