Building up to Macroprogramming: An Intermediate Language for Sensor Networks