added toggle logic for view