Cleaned up some code, started using stacks and queues as part of the implementations