Moved parameters higher up to allow easier testing. Added a method to try different params with outlier detection