modified code to work with merge