added "trim" parameter to getMetadataFields method