adding quality flags