An improvement to k-nearest neighbor classifier