tidying up, using arrow functions, making fewer emits, waiting for onload event before collecting metadata