Some fixes and clean-ups for the big merge