Changing some functions, probably removing the get_directory()
testing each flag now.