added notes & small refactoring