modularizing merge