added a few comments and removed some lines