new improved version of metadata generator script