added commandline option to quit after X cycles