add the tail recursive