Fixed some syntactical errors and added tons of comments.