Changed variable names to make the dependencies of variables more apparent.