Added lots of comments and added some code