big refactor to move event handling out of Shell.cpp