Take the code from page 4 and replace the ent_merge function with the ent_merge function above