Better config, code cleanup