Returned cycle testing for best performance. Created testWithTimeouts function with requested functionality