 		end
 	end
 
-	def show(conn, %{"poll_id" => poll_id, "id" => reference_id}, _, _) do
+	def show(conn, %{"poll_id" => poll_id, "id" => reference_id}) do
 		poll = Repo.get(Poll, poll_id)
 		reference = Repo.get(Reference, reference_id)
 		if poll do

			|> Repo.all
			|> Repo.preload([:approval_poll])
			|> Enum.filter(fn(reference) ->
				approval_result = Result.calculate(reference.approval_poll, Ecto.DateTime.utc(), TrustMetric.get(trust_metric_url), vote_weight_halving_days)["true"]
				is_approved = approval_result["mean"] > 0.5 and approval_result["total"] >= 1 and approval_result["count"] >= 1
				is_approved
			end)



	plug :scrub_params, "reference" when action in [:create]

	def index(conn, params = %{"poll_id" => poll_id}) do
		# TODO: Inverse references, all references / only approved
		# TODO: Is approved config in params (mean, total)
		trust_metric_url = Map.get(params, "trust_metric_url") || TrustMetric.default_trust_metric_url()
		vote_weight_halving_days =
			if Map.get(params, "vote_weight_halving_days") do
				{value, _} = Integer.parse(params["vote_weight_halving_days"])
				value
			else
				nil
			end
		datetime =
			if Map.get(params, "datetime") do
				Ecto.DateTime.cast!(params["datetime"])
			else
				Ecto.DateTime.utc()
			end

		poll = Repo.get(Poll, poll_id)
		if poll do
