added some comments and removed uneeded code