Refractored some code
Refractored some code