Refactor and improve various functionality.

Implement a more generic and extensible configuration file parser