Where did 50 come from?  Magic numbers always tend to make me nervous as they offer no insight as to what this quantity actually is intended to represent.  Defining this as a named const int at the top would be best.