merge previous and next keys