Enforcing integer input
Changed default value of max to 0, logic correspondingly