updated js example, refactored a bit
finished parsing