Rewrite zeromq commands.
Use pthreads for thread command.