reduce code duplication