 
         [{b, e} | rest] ->
         # Being inactive < 5 minutes just merges into one record
-        if Timex.diff(now, e, :minutes) < 5 do
+        if Timex.diff(timestamp, e, :minutes) < 5 do
           [{b, nil} | rest]
         else
-          [{now, nil}, {b, e} | rest]
+          [{timestamp, nil}, {b, e} | rest]
         end
       end
 

      case record.entries do
        # First session seen.
        [] ->
          [{now, nil}]

        # Already have an open session.
        [{_, e} | _] when is_nil e ->

    |> Enum.into(%{})
  end

  def log_active(user, timestamp \\ DateTime.utc_now) do
    record = get_user_record(user)

    unless record[:meta] do
