Templating work for sorting bits.