refactored for clarity and configurability
Merge pull request #263 from binford2k/wip/rafactor_for_integration

refactored for clarity and configurability