refactor metadata.go