Implementation of https://lemmy.dbzer0.com/post/15339322