Thanks for the advice Kypros, I found the problem to be the lack of a comma. I found the program to be hanging by add in a couple of leds and some toggle commands between at commands.
I used the debug command instead of the serout as I could not get the serout to work properly for some strange reason.