Refactored to support for SelectImages and SelectFolders