Added configuration system.
Fixed bugs with config system, and added unit tests.