Release 3.1 code cleanup