Process template logic