a code-complete but untested version of pubsub