Added settings dialog box
Cleanup code