added the main algorithm class