added a working code