Added print statements to look for bugs.