add before delete action for navigation, make code more readable