Better config handling and code tweaks