selectedDirectories fix + some Main class refactoring