Implement configuration merging

Ref #418.