Fixed tail handling.
Enabled merging.
Several minor bug fixes.