Fixed issue #4. Also fixed issue where cancel button on close wasn't working as expected.