Installing source map support.

Forgot to add source map support in the list of dependencies.
Some refactoring to clean things up.

Refactored code to put more on the models.