added a neighbour tracker and a lot of hascode stuff