I am not sure about this logic. It reads if current_task is the only task look at it otherwise look at current_task+1. Why not look at the current_task always?