Minor point, but as sd isn't used in the callback, you could just pass NULL as the third parameter.