refractored some code
refractoring code