Added logic to sort out terminus and returnHome for reverse(), improved tests for reverse()