added and tested 2nd function

added new comments
added 2nd function
added tests
and added comments