Small update. The code now updates immediately after the p instruction has been executed, and not 1 step later
Really fixed it now