Refactoring and better class linearization