Added debugOutputWindow to Settings dialog (use ChooseMetadata button). Refactored some methods.