Added rawdata and metadata handling