Reverted to not use "min"