Ok I think I figured it out. By changing "clk=0;" to clk=23; in both places! It appears now to start bang on time.