updated documentation

Moved function documentation before functions, as is customary in
JavaScript.

Also added some documentation strings.
added screenshot