Fixing to fit with new structure.
Restructuring gfan rules.
Moving more code to core.