Remove useless comments and add error checking.