adding error handling for creating messages := logging in