Reimplement SS2 code in ss3