added logic to find the longest chain - still need to impl fits function