Can you just inline `midpoint` instead of defining a separate function?