Uploaded code and comments

Code for both functions is included as are some minor comments