adding functionality, comments and unit test