added MIT License and fixed some code style flaws.