Replace hard-coded numerical limits by MIN/MAX constants