more tidying and factor domain code out of puzzle.input