added frame merging