Insert some debug statements and asserts