improved functionality with keyPair and wait_until