Revert "Merge pull request #3243 from dimagi/dead-code"

This reverts commit 4e8e19d017dbac38ddaef98f2887e6e806271c15, reversing
changes made to fb7e0aa3187e9b15e630583f02c7beb7be15feac.
clean up/fix the code I should not have deleted
Merge pull request #3245 from dimagi/revert-misguided-delete

Revert misguided delete