added some code to work with metada