Changed Reorder in order to account for call graph

It used to be only return type dependencies between functions.
Also fixed the typedef problem