Added function comments and comments