'doc' function improved.