Update unit tests and clean up generator code