introduced abstract agorithm class, added test