add new code.
adding old code for ios.