Refactor submit_sm to avoid silly unnecessary recursion.