added only_public arg to dir_dict function