factor out the get_files function
cleaning the get_files function and its call
factor out the get_api function