some more refactoring to degrade some fields to local variables