code to make merger tree