Refactor classes, add comments