redesigned class structure, has a working solution