Fixed negative branching and added some C debugging