Added depth -> ascii conversion and rewrote iteration function in tail-recursive style