add comments, remove unused variable