Code clean-up; fix tests
Fix closing 'Debug' view after stopping the app