Updated comments and added docstring.