Made some changes in code structure.