Added support for generating source maps

I tried to maintain a similar coding style for the changes, but let me know if there's anything you'd like changed!