Spray Theory and Applications