Added debugging statements and corrected an errornous condition .