Adjusted comments to accurately describe the code that follows them. Added a new flowchart, adjusted maincode flowchart as revisions from the feedback I received.