Latest code with modification.