final refractored