improved print strings
added tail recursion implementation