SERVER-8791 SERVER-9165 SERVER-9212 move build into own class, clean up getKeys calls