Finished documentation for each function and cleaned up each function.