How gliders use thermals