Minimise some duplicate code.