merged in some changes from paulojorge-tcinet