Refactor the mq-server