Tidied.
Use PackageIsVisible, PackageIsDownloadable and PackageIsRemovable flags from package parsed structure.