Refactor: extract config loading