Reduce code repetition