implemented neighbors() and corresponding unit tests