Rob,
You really don't state what the problem is, only that you see a problem.

A quick scan of the code leads to too many questions for me.
What are you trying to accomplish in the different subroutines Rapid, Sleepy and Flash?
You seem to be using two GPIO pins, one for Rapid (GPIO.0) and another (GPIO.5) for Sleepy and Flash.
Another question is why in each of the subroutines are you setting the GPIO high, pausing and then configuring the same GPIO as an input?

Without more info, it is futile to offer an opinion.