Refactored forwardAlgorithm function. Modularized function alpha_t for future use in BackwardAlgorithm
Implemented backward algorithm