move buffer switching code to core_view.py