Minor bug.
Add docstring and made pythonic the way to compute the neighbors.