changing timeout API and improving tests