added a more time/space efficient Path.isSimple() implementation.