Added debug code to observe $action behavior