Updated the data processing for query a & b