rewrote the ta utility function