hosue keep and add merge algorithm