template fitting method added