Refactored options into separate method and fixed bugs