code to handle action