fixed a bunch of compiler warnings; wrote function to get topN data points