     |> length
   end
 
+  # Returns a filtered list of all living positions within `positions`.
   defp get_living_neighbors(positions), do: filter(positions, &(lookup(&1) != nil))
 
+  # Get the living neighbors of `position`.  If there are exactly 2 or 3, this `position`
+  # lives, otherwise it will be destroyed.
+  # Returns itself if it should be destroyed, otherwise returns an empty list.
   defp to_destroy(position) do
     position
     |> count_living_neighbors

    |> get_positions_to_create
  end

  defp get_neighboring_positions({x, y}) do
     @neighbor_offsets
     |> map(fn {dx, dy} -> {x + dx, y + dy} end)
  end

  defp get_dead_neighbors(positions), do: filter(positions, &(lookup(&1) == nil))

  defp lookup(position) do
    Cell.Registry
    |> Registry.lookup(position)

  # Callbacks
  #############

  # Calculate neighboring cells to create, and whether the current cell should die.
  def handle_call(:tick, _from, position) do
    {:reply, {to_create(position), to_destroy(position)}, position}
  end

  # Get the neighboring positions of `position`, filter out the dead neighbors,
  # then get the cell positions which should be created and return them.
  defp to_create(position) do
    position
    |> get_neighboring_positions
