CORE-5525: removed some more dead code and did a little factoring