refactored new opts hash feature
* added unit tests for opts hash feature