updated entity view function to use templates