Rename two variables as per Timo's suggestion.
Add documentation.