Update Code Documentation, Small Fixes

Update the code documentation. Add comments for specific code stuff, and
add the docstrings, where needed.