Some refactoring of active record classes