* added Javascript block
* few modifications to avoid bugs