Updateed "fwd_rev" fuction so that program does not freeze when function runs.