add ternary operator

also rewrites a bit to ensure speed of parser
fix for loop iterator variable name bugs