Moved dataStructures to own file.

Lots of JavaScript code cleanup.