Move sandbox related functions into JSM.
Remove unused imports/definitions.