Code update

* licence change
* Code upgraded
* Bugs correction