fixed logic error in solve(). now goes to end, but drawing path isnt clean.