add logic for view