updated my merge code to be easier to read