add function to view