Added comments and renamed variables.