introduced process_neighbours function