see line 606-607 (swapping ```templ``` and ```img``` if the first one is bigger)