refactor structure, add comments
fix merge conflict w.r.t. refactoring