added optional triples
added ordering