Included comments and fixed some small errors