Some fixes in test programs.
Use some references instead of copies where needed. Indentation fixes, while we're at it.