Added test procs and debugging statements, fixed queue bug