Avoid duplicate declaration by using ensure_packages

Changed the installation of $system_packages to use ensure_packages to avoid any duplicate declaration in common packages.

Let me know if you would like some in-line comments or anything.

```
ensure_packages
Takes a list of packages and only installs them if they don't already exist.
```