Move resolve logic into its own module.