Made an actual running loop.
merging the example