Refactor the installer

There was some duplicate code (extras inserted multiple times)
and the function signatures didn't always match the content of
the method.