refactor sandebox.js to prepare for proper linting