Factor about a bit of repetition

Closes #14