New method for listing the files of a directory and general improvements