added computing forward to a function