adding template and view function