Add level traversal function.