renamed variables and changed a few comments