Moving neighbors logic into standalone module