adding templates and some changes