Rewrote input_minmax, fixed input_type