Refactor code around accessing options

See commits.