Tidied loging, add try catch to check msg comes in the right format