Fix tuple flattener, so it now returns correct value (correct type & value) of flattened tuple.
More template-metamagic for tuples. Rewritten select_statement and friends.