Improve template loader