refactored to use block for setting options