Now using priority queue. I should clean the source a little bit...