Added Test Code
Slightly Improved TypeScript Version