Move implementation-agnostic things to their own module.