Some fn gen cleanup
Some fn gen refactoring