change detect_max to a collection of functions rather than a class