Reduce duplicate code.