modified the handler to add console logging.