Refactor classes and attributes