Better debugging and added . printing to avoid timeout