Move Metadata code into metadata.go