modified nupic.core