     defp to_condition([:'>', version | _]) do
       {major, minor, patch, pre} = parse_condition(version)
 
-      {:orelse, main_condition(:'>', major, minor, patch),
-                {:andalso, main_condition(:'==', major, minor, patch),
-                           pre_condition(:'>', pre)}}
+      {:orelse, main_condition(:'>', {major, minor, patch}),
+                {:andalso, main_condition(:'==', {major, minor, patch}),
+                           {:andalso, no_pre_condition(pre),
+                                      pre_condition(:'>', pre)}}}
     end
 
     defp to_condition([:'>=', version | _]) do
       matchable = parse_condition(version)
 
-      {:orelse, {:'==', :'$_', {:const, matchable}},
+      {:orelse, main_condition(:'==', matchable),
                 to_condition([:'>', version])}
     end
 
     defp to_condition([:'<', version | _]) do
       {major, minor, patch, pre} = parse_condition(version)
 
-      {:orelse, main_condition(:'<', major, minor, patch),
-                {:andalso, main_condition(:'==', major, minor, patch),
-                           pre_condition(:'<', pre)}}
+      {:orelse, main_condition(:'<', {major, minor, patch}),
+                {:andalso, main_condition(:'==', {major, minor, patch}),
+                           {:andalso, no_pre_condition(pre),
+                                      pre_condition(:'<', pre)}}}
     end
 
     defp to_condition([:'<=', version | _]) do
       matchable = parse_condition(version)
 
-      {:orelse, {:'==', :'$_', {:const, matchable}},
+      {:orelse, main_condition(:'==', matchable),
                 to_condition([:'<', version])}
     end
 

      end
    end

    defp main_condition(op, major, minor, patch) do
      {op, {{:'$1', :'$2', :'$3'}},
           {:const, {major, minor, patch}}}
    end

    defp pre_condition(:'>', pre) do

                                                {:'<', :'$4', {:const, pre}}}}}}
    end

    defp no_pre_condition(pre) do
      {:orelse, :'$5',
                {:const, pre == []}}
    end

    defp matchable_to_string({major, minor, patch, pre}) do
      patch = if patch, do: "#{patch}", else: "0"
      pre   = if pre != [], do: "-#{Enum.join(pre, ".")}"
