Part rewrite. Working logging and config system.