Comments added and minor change in var names