Less code than in commit c3b327dbe75b36640bd2df6880ecb4b98c2eff8b
Thank you @budparr and @parkr