Fixed a few things with tuple-merge and cleaned up code.