extracted anon classes into named inner classes
further streamlined code (without functionality change)
still long way to untangle, but it's a start