Refactored entire q-learning system to update state_t-1.