Code cleaning
Add copyright
Improved code