Fixed for loops and correct some bugs in if statements.

Bug with scoping still persists.  Most recent test with single variable and single nest level show problem still exists.

Added basic frame work for function calls.