Added flowcharts and made some minor edits to the code