RDC: 10/3/2003: changed the logic of the program to avoid using global data.
