updated  code