Spatial pooler ongoing dev

Refactored a lot to encapsulate state in another class and remove if from the Spatial Pooler - fix tests so they work with new architecture
Weird indentation here.