with debug printouts