Adding prints to see what's going wrong