added a lot of debugging code, a line to trace the start of each function