Optimization

Removed unused variable.
New Version

Appends output to a string then prints at end to overcome console output
limit