Refactor config.{c,h}

Signed-off-by: Niklas Koep <niklas.koep@gmail.com>
Merge pull request #41 from nkoep/refactor-config-code

Refactor config.{c,h}