refactor forward computation