Removed memory leak

Refactored the JS implementation to use a fixed number of objects. Previous implementation wasn't cleaning up Raphael objects properly and was leaking memory.