replacing const with def
implementing dynamic timeout