Refactored some of the code in my get_data function in funcs.py