refactor MQTT