Minor changes here and there (typos, more coherent names of functions
and variables etc.).