Added configuration handling and improved message sending