Metadata parsing to get customer id and refactored