move metadata var up
add metadata callback