added detect_outliers function