Add tail recursion and initial memory bot