added javadocs and fixed timeout