merging with ends markers