Refactored into a much simpler version in SQSQueue2.js