Reduce duplication of code.