Added a better ta function