fixed bug when setting together neighbourhood
introduced structures for further handling, computing directly std instead of variance