changed Main to a template