Refactor: move code around panel reopening into checkForReopenPanel()
(#18)