refactoring + commenting + improving code readability