This is a bug fix. Other changes are done only for readability improvement.