starting code for forward