implemented feed forward algorithm