Comments added to code

Added some descriptions for the overall function and the specific
functions