Deleted "$max" variable (Only used once)

I deleted your "$max" variable because you only used it once, which could have been replaced by just the number "1000" so I went ahead and changed it for you. :) 

Although it might have just been your personal preference, figured it was worth suggesting anyway.