Refactor config loading and add erb support