added comments and deleted unuseful code