Refactor classes and packages