Add better JavaScript function patterns

Closes #8
Closes #40
Closes #53