use unit for t ; slightly refactor