move tr1 detect code into hpp