Added Timon Gehr's Tristate implementation