Refactor bundle resolver code to facilitate reuse