small refactor and fix comments