Move config parsing into separate function