Changed print to echo in debug loop