Fixed hilbertsort and added sorted check.
Count octree nodes, determine layers, allow repetition.