made waiting for input more efficient by adding sleep commands