Removed all_in_files from being public, added a mutex to ensure code is threadsafe