all algo code and related test code