add function to switch edit and view