changing echos to printf