just a late night djikstra implementation