added some comments, also added a unit test for new method