Pausing program with infinite loop?