clean up collect_max

allow collect_max to handle primitives other than strings and doubles, and add a collect_min UDF