refractored method