adding some comments, removing an unused variable