Changed alg1 to only consider suffixes. It totally worked on a small hand-written test, including indecies