working on figuring out proper algorithm