lots of PSR2 code cleanup