Final debugging; all working now.