Adjust types merge, other code improvements