Added a basename var to file_struct at the end, making it clearer