Move package finding to its own function.
Fixes #10.