Refactor classes into packages