Added comments, and used Python 3.2 for perplexities.