Refactoring
+ improving logging