adding min/max functionality