working template loading functionality