moved pqify helper function