would it make sense to create a helper for the md5/hex-digest pattern? it shows up a bunch in this function.