add test for algoritms
refactoring