final code by abhijeet