Improve best file selection
Fix removing empty package groups