added flowchart and small tweaks to the code

Added flowchart for first 6 functions in both pdf and graphml format.
graphml is native format for a yEd project.  Added a small tweak to the
code and create all variables needed at the top of the function instead
of throughout the function when possible