almost merged emil's NN with Jacob's datastructure