Changed main to use graph

also moved exceptions around, changed printmap function