Wait should use timeout option not hardcoded value, also some simplification in lambda function.