rewrote JS parsing and building. added support for custom writers