made minor edits to code and commented it