further work on edit and delete and templating