Added slightly smarter checks for required and recommended packages.