refactored temporal pooling, added dynamic grid expansion