Modified last function for question 2.4

Added comments, author etc...