Switching behaviour and css inline editor fixes

This includes all code from the switching behaviour branch and the editor fixes branch