code cleaned, added template.