changed to use priority queue
cleaned up code
updated metric
fixed error message