made Javascript to call Init API

Bug fixes to init API
Merge pull request #8 from littlehawk93/init

made Javascript to call Init API