Fixes #24
Cleaning code a bit; fixing errors throwing upon a dialog cancel