re working code