Fix JavaScript Binding Memoryleak

Based on #645 with a few other changes

- Cleanup cpp include statements (I had left them pretty messy)
- Fix formatting from original PR