Bug fixes, debug code, finish functions

Fixed some bugs where the wrong array was being used
Adding some debugging code
Filled out 'processQueue' function