refactoring and unifying OptionalPackage and OptionalBackendPackage