Refractored and Updated