Prevents pollution of global namespace in SP.

Adds anonymous function wrapper around core SP code, preventing global
namespace pollution.