Added some comments and deleted unnecessary code