Various improvements - fixed #40 and syncronized with TypeScript release.