Reduce redundant code