Removed MQTT stuff and changed some existig code
merged with amit's commits