use min/max helpers instead of creating new arrays