Removed the candidate == goal check. If distance == null we don't want to go into that branch ever!
The other changes are only removed whitespaces