Unreliable SMS message reception on Arduino with GSM modem

Since I am using the system 24x7, I use the above routine to check if the modem is responding from time to time. If the modem don't respond, the GSM 800A module is given a software reset.