The use of delay() may be acceptable when prototyping but not for full blown applications. Once an AT command is sent you need to wait until you have a response; any further command sent before a complete response will be ignored. You should also check the response for any error conditions.
There is a routine somewhere in this section which should help you. It waits until it starts to get a response, then reads all the characters into a buffer until there are no more to read. IIRC Robtillaart had some input but it wasn't his thread.