Improve template reading from config