fixed some comments. renamed variables for clarity