Fixed bug in load_directory and added count_results function