moved template stuff in template