Improvements to LWT handling and added clientid config parameter