Updated QA algorithm