Extract app controller functions to separate file.
Add option to make the graph directed (only visually for now).