trivial: Fix up some whitespace issues
Add an installed flag as an additional optional check for comparing packages
When there are two versions of the same package, prefer showing the installed version