tripledollar function improved