Better handling of figcaptions.
Better forEach usage.
Maybe more efficient initialization.

(At least the code is slightly shorter.)