added notes to main algorithm
added new version of algorithm by defining new class