A lot of substring calls replaced with a queue.