Rewrite code for SS3