Update comments and clean up code.