uses options, and significant refactoring