todo modified and code commented
some comments added