Refactoring and security improvements to FileBrowser.