fix loop and add pause