     }
 }
 
+struct Version: Comparable {
+    let major: Int
+    let minor: Int
+
+    static func < (lhs: Version, rhs: Version) -> Bool {
+        if lhs.major == rhs.major {
+            return lhs.minor < rhs.minor
+        } else {
+            return lhs.major < rhs.major
+        }
+    }
+
+    static func == (lhs: Version, rhs: Version) -> Bool {
+        lhs.major == rhs.major && lhs.minor == rhs.minor
+    }
+}
+
 func getUniqueSortedModels(havingPrefix: String, from deviceList: [String: [String: AnyObject]]) -> [Model] {
 
     let filteredDict = deviceList.filter { $0.key.hasPrefix(havingPrefix) }
-    let models: [Model] = filteredDict.values.compactMap {
-
-        guard let version = $0["version"] as? NSNumber, let enumCase = $0["enum"] as? String else {
-            print("Can't create model from this: \($0)")
+    let models: [Model] = filteredDict.compactMap { key, value in
+
+        guard let versionString = findMatch(for: "[\\d]*,[\\d]*", in: key),
+              let version =  getVersion(from: versionString),
+              let enumCase = value["enum"] as? String else {
+            print("Can't create model from this: \(value)")
             return nil
         }
-        return Model(version: version.doubleValue, enumCase: enumCase)
+        return Model(version: version, enumCase: enumCase)
     }
 
     // Get the unique models i.e. ignore models which has same enum, we don't want same enum twice in case that


}

// MARK: - Calling Main

main()


struct Model: Hashable {

    let version: Version
    let enumCase: String

    func hash(into hasher: inout Hasher) {
