Changed order() to handle cases where loops aren't complete.

Returns an error message. May change it to auto-repair loops later, once i consider the implications of that.