Optimize getNeighbor function in NewsManager and clean code