Mercilessly refactor queue code to make about 3 times faster :-P