Some code refactoring, added logs