Fixed some syntaxes, minor code issues, and provided comments