Separated functions that don't need onload, added async