added support for dynamic timeout