Made a lot better (to match 2.4 branch changes)