update working code