Tidied up option-parsing code (three-strikes-then-refactor)