The main WFG code should work

mainWFG contains the function wfg(...), which is called from the main
file, returning the phases. wfg() now takes more arguments, so the main
file is also updated. NOTE: the main file crashes on line 105 in the
main file, the WFR part, please update!