Added some comments so I can remember how it works!
Added GPL licence information to source files.