Added "Get nearest Neighbor" and refactored