Simplify Temporal Memory code