Variables renamed and comments added.