Some refactoring of classes