Reduce code duplication