Updated some commenting to make the code more clear