Refractored some Code

Just refractored some code.