Cleaned up the sleeping in sendevents.c