Put metadata output in own function