declare $loop outside of start()