added pseudocode and definitions and formatted merging section of paper