Rename and rearrange some variables.

Based on discussion with @dcoutts.