schema: Small internal refactoring (+ tests).