Some refactoring and adding exit confirmation.
Fix for memory issue with listview.