cycle algorithm final adjustments and tests