Changed some variable names and add more comments
Changed some variable names and a log message have been added