Added branching, fixed function calls, added printf