capture all the exceptions and also implemented some logic to capture menu actions.