Wrapped sections into functions, then called all the functions at the end.
Missing declared globals
increment() uses $ARG0 and $ARG1, not $0 and $1
unindent proml()