Add @tailrec annotation before tail recursive methods.