Added MAX_RETRIES parameter.

When CHECKIN_WINDOW=0, the program gives up too early. Fixed this by adding a
MAX_RETRIES parameter instead.