Minor refactoring: split all struct emitting code to bottom part of emit file.