improved sync handler and templating