Since this code is very similar, we can include a common file to help keep the implementations in sync.
A few minor bits of tinkering.