Simplify Temporal Memory code
Merge pull request #1474 from chetan51/issue-1473

Simplify Temporal Memory code