updating algorithm class with comments