Almost working for the sqs case. Just need to figure out the cutoff.