refactoring util
add pubsub and util