Merge with #29. Using standard js code style (ugh...); rewritten documentation in markdown; Added example6