code cleanup
separating pubsub and sockets