Fixed lots of bugs

Half overhaul of notebook focus events...