Refactoring creating options into a function