set logging level to debug. added debug messages. clarified some variable names