Added the GPL notices

Also added a few comments to the code.