Move sampling logic into javascript
Move sampling logic into javascript
Merge branch 'temp'
Merge pull request #54 from kurtpayne/master

Move sampling logic into javascript (thanks, @kurtpayne!)