Extract rw_config into module, and clean it up a little.
Merge pull request #434 from binarylogic/cleanup_rw_config

Extract rw_config into module, and clean it up a little.