changing riemann to UDP and pulling more helper fns into here