Changed the program's flow to be a bit more modular

Removed the side effects from the speedtest function
Added a callback feature to the speedtest
created a function that updates the quality