Cleaned up BuildFileWrangler.

Factored out code shared between two BuildFileWrangler methods.