Making config options work. Reorganizing code.
Fixed config loading bug.