Adapt code to merge