Sacrifice some micro-optimization to remove duplicate code

This just removes some duplicate code.