add comments + refactor