minor reordering of the method code