Changed the ER generator to make more sense.