Implemented logging in