Algorithm implemented
Comments added