Added tests for tuple casting, debugged minor errors, tidied up casting in Javascript.
Merge pull request #22 from DanielJCampbell/master

Added tests for tuple casting, debugged minor errors, tidied up casting in Javascript