added loging functionality