added possibility to set timeout