Common code extraction