Better class merging