clean up config parsing; add support for env var expansion