added polling logic to the encryptor