Changed variable names and other minor fixes.