split up functions into new files and laid foundation for dfs