Fixed loop detection

Cleaned up a bit using the hasError pattern more sparingly, which made
it easy to check for loops (i.e. neither the start or end of the passage
ran off the board)