Optimizing javascript

Async just didn't work out the way i wanted it