Added fully working code