No longer using priority queue, which is good (less memory). Code is still very messy but functional