Taken from lix/web-services, commit hash 6d29ce968e64225faf03450c063d11a0a5c89cac Co-authored-by: Jade Lovelace <lix@jade.fyi>