Code cleanup and fix compatibility for ss 3.2