added some comments and whitespace