Code wasn't working, fixed the main loop