Adding copyright and comments. Removing debugging code.