finished main algorithm, added forward probability