Clean up, clean up, everybody clean up!

Actually--this fixes the bugs that were made by the last commit.