Commenting and cleanup for final submission
Added ability to profile to log, or to screen (-v). Broke some functions out of main.