Increased the speed of the neighbours function by changing to using standard arrays.