merge code improvements