Added GPL 2 License and fixed bugs