Forward algorithm completed and commented