added javadoc comments
reduced cpu usage