rewrited get_neighbors_count method and some minor changes