Partial revert from commit ca71ec52