Adding Loging functionality