Added some comments and simplified a line.