Moved queue allocs and swaps to datastructures.c