Added comments and fixed typos