refactor to use hash of options