Use pcase-dolist to simplify iterations