render function now fetches templates