tweaked code order