Could you write this in a more functional style? i.e. basically by improving the old `not.installed` package?