This commit also makes better names for several of these functions, and removes one that went unused.