This avoid duplication and could conceivably let us test this stuff in code later on. Signed-off-by: Stephen Finucane <stephen@that.guru>