Added a maximum value for inputs to avoid runtime problems.