Removed lambda as argument
Added comments
Corrected small errors