Added a fuction to view and edit record