Revert "Moved most commands into their own functions."

This reverts commit 3dcf092cfb8411acee10942978db98e14bb9ae22.