spray theory and applications