     do_macro(eval, elixirscript_env)
   end
 
-  def add_require_macro(elixirscript_env, module, opts) do
+  defp add_require_macro(elixirscript_env, module, opts) do
     eval = """
     require #{inspect module}, #{inspect opts}
     __ENV__

        func in only
      end)

      %{ env | requires: Enum.uniq(env.requires ++ [module.name]),
         functions: List.keydelete(env.functions, module.name, 0) ++ [{ module.name, functions }],
         macros: List.keydelete(env.macros, module.name, 0) ++ [{ module.name, macros }] }
    end
  end

  def add_import(env, module_name, [except: except]) do
    case ElixirScript.Translator.State.is_module_loaded?(module_name) do
      true ->
        add_import_macro(env, module_name, [except: except])
      false ->
        module = get_module(env, module_name)

        {_, current_functions } = List.keyfind(env.functions, module.name, 0, { module.name, module.functions })
        {_, current_macros } = List.keyfind(env.macros, module.name, 0, { module.name, module.macros })

        macros = Enum.filter(current_macros, fn(mac) -> not(mac in except) end)
        functions = Enum.filter(current_functions, fn(func) -> not(func in except) end)

        %{ env | requires: env.requires ++ [module.name],
          functions: List.keydelete(env.functions, module.name, 0) ++ [{ module.name, functions }],
          macros: List.keydelete(env.macros, module.name, 0) ++ [{ module.name, macros }] }
    end
  end

  def add_require(env, module_name) do
    case ElixirScript.Translator.State.is_module_loaded?(module_name) do
      true ->
        add_require_macro(env, module_name, [])
      false ->
        module = get_module(env, module_name)
        %{ env | requires: Enum.uniq(env.requires ++ [module.name]) }
    end
  end

  def add_require(env, module_name, alias_name) do
    case ElixirScript.Translator.State.is_module_loaded?(module_name) do
      true ->
        add_require_macro(env, module_name, [as: alias_name])
      false ->
        module = get_module(env, module_name)

        %{ env | aliases: Enum.uniq(env.aliases ++ [{alias_name, module.name}]),
           requires: Enum.uniq(env.requires ++ [module.name]) }
    end

  end



  end

  defp check_for_module_existence(env, module_name) do
    if !ElixirScript.Translator.State.is_module_loaded?(module_name) and !has_module?(env, module_name) do
      raise "Module #{inspect module_name} not found"
    end
  end


  defp add_import_macro(elixirscript_env, module, opts) do
    eval = """
    import #{inspect module}, #{inspect opts}
    __ENV__
