Refactored timeouts and added javadoc