Complementing David's changes with formatting, adding documentation, etc. More `*'-convention formatting, adding the `a' resp. `an' prefix to variables.