Refractored to work with new class structure