updated to work with sparks.js