added comments descibing original algorithm