tidying up some functions, added get/set ir mode. improved tests