Added .tailrec annotation