Modified some areas according to my need.