added comments and substituted magic numbers for constants to explain the sizing of the text box in optimalSize.