reviewed some comments and small refactoring