Updated the Aman & Anshul's code.