Added docstrings for everything.
Minor changes to dom functions.