changed distance to manhattan distance