Working run_analysis() function