Added Copyright notice, some comments, replaced a loop with dict.update()