Add terminal type detection

Logic used came from Synchronet
Change default root namespaces