diff --git a/src/config.rs b/src/config.rs
index c98d967b8c6f09cda9df329c5afd33478c0c3f5b..520e633f3e8f164348695e0fa5872ffb621226e4 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -2,8 +2,8 @@
 
 use ini::{Error::Io as IniErrIo, Error::Parse as IniErrParse, Ini};
 use log::{error, info, warn, LevelFilter};
+use std::{env, path::Path, process::abort};
 use url::Url;
-use std::{ process::abort, path::Path, env };
 
 pub struct Config {
     pub display_name: String,  // The display name to set for the bot
@@ -61,9 +61,12 @@ pub fn write_default(file_name: &String) -> Result<(), String> {
         .set("id", "@some_id:matrix.org")
         .set("password", "no-password")
         .set("display_name", "MGB-Hitagi");
-    return match conf.write_to_file_policy(file_name, ini::EscapePolicy::Everything) {
-        Ok(()) => Ok(()),
-        Err(e) => Err(e.to_string()),
+    match conf.write_to_file_policy(file_name, ini::EscapePolicy::Everything) {
+        Ok(()) => {
+            info!("Default config file written to {}", file_name);
+            return Ok(());
+        }
+        Err(e) => return Err(e.to_string()),
     };
 }
 
@@ -84,6 +87,7 @@ pub fn check_argument_or_abort(should_write_default: bool) {
             );
             abort();
         } else if should_write_default {
+            warn!("Try to write the default config file to {}", default_file);
             match write_default(&default_file) {
                 Ok(()) => error!(
                     "Args count is {}, you need to only specify the config file for the bot. \
diff --git a/src/main.rs b/src/main.rs
index d3a9be77165dfb5ea64a340b8f96b06406e6e82b..4f15b66b8a56eef270ecffe603ece409c61c3b2b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,17 +1,9 @@
-#![allow(unused_imports)]
-
 mod config;
 mod matrix;
-use crate::config::Config;
-
-use log::{error, info, warn};
-use log4rs;
-// use log4rs::config::{Appender, Config, Logger, Root};
 
+use log::{error, info};
 use matrix_sdk;
-use std::convert::TryFrom;
-use std::path::Path;
-use std::{env, process::exit, process::abort};
+use std::{env, process::abort};
 
 #[tokio::main]
 async fn main() -> matrix_sdk::Result<()> {
diff --git a/src/matrix.rs b/src/matrix.rs
index 6ecd4c8b97050d341f5870a6647d956f23c2782d..78f91b08855d4a9e5cc1f03b3ffe3d41fba0e348 100644
--- a/src/matrix.rs
+++ b/src/matrix.rs
@@ -5,16 +5,12 @@ use matrix_sdk::{
     room::Room,
     ruma::{
         events::{
-            macros::EventContent,
-            push_rules::PushRulesEvent,
             room::message::{MessageEventContent, MessageType, TextMessageEventContent},
-            room::topic::TopicEventContent,
-            AnyMessageEventContent, AnyRoomEvent, AnySyncRoomEvent, StateEvent, SyncMessageEvent,
-            SyncStateEvent,
+            AnyMessageEventContent, SyncMessageEvent,
         },
-        Int, MilliSecondsSinceUnixEpoch, UserId,
+        UserId,
     },
-    Client, LoopCtrl, Result, RoomInfo, SyncSettings,
+    Client, Result, RoomInfo, SyncSettings,
 };
 use std::convert::TryFrom;
 
@@ -29,24 +25,39 @@ async fn on_room_message(
         return;
     }
 
-    if let Room::Joined(room) = room {
-        let room_name = match room.name() {
-            Some(n) => "<".to_string() + &n + ">",
-            None => "<--none-->".to_string(),
-        };
-        let _body = match ev.content.msgtype {
-            MessageType::Text(TextMessageEventContent { body, .. }) => "Text: ".to_string() + &body,
-            _ => "Unsupported type".to_string(),
-        };
-        info!(
-            "{} a.k.a. {}, from {}",
+    let room_name = match room.name() {
+        Some(n) => "<".to_string() + &n + ">",
+        None => "<--none-->".to_string(),
+    };
+
+    match room {
+        Room::Joined(room) => {
+            let _body = match ev.content.msgtype {
+                MessageType::Text(TextMessageEventContent { body, .. }) => {
+                    "Text: ".to_string() + &body
+                }
+                _ => "Unsupported type".to_string(),
+            };
+            info!(
+                "Got message from {} in {} a.k.a. {}",
+                sender_id,
+                room.room_id(),
+                room_name
+            );
+            // room.send(
+            //     AnyMessageEventContent::RoomMessage(MessageEventContent::text_plain("Hello world")),
+            //     None,
+            // )
+            // .await
+            // .unwrap();
+        }
+        Room::Invited(room) => warn!(
+            "Bot was invited by {} to room {} a.k.a. {}",
+            sender_id,
             room.room_id(),
-            room_name,
-            sender_id
-        );
-        let content =
-            AnyMessageEventContent::RoomMessage(MessageEventContent::text_plain("Hello world"));
-        room.send(content, None).await.unwrap();
+            room_name
+        ),
+        Room::Left(room) => error!("Bot left room {} a.k.a. {}", room.room_id(), room_name),
     }
 }