Added structure using the same dfs function. Wrote descriptions of the functions. TODO fix descriptions to make them more readable.