EDITED Psuedocode

Very few changes. Also could not add anything (could only edit text and
move stuff around) because Lucidchart trial had expired. Had to make do
but came out okay.