Merge Gagan's code [Karun Dhir]