     |> filter(fn showtime ->
       !Enum.any?(showtimes_from_db, fn saved_st ->
         saved_st.title == showtime.title && saved_st.cinemahall == showtime.cinemahall &&
-          saved_st.showtime == showtime.showtime
+          DateTime.compare(saved_st.showtime, showtime.showtime) == :eq
       end)
     end)
   end
 
-  def get_saved_movie_titles() do
+  @spec get_saved_movie_titles() :: [String.t()]
+  defp get_saved_movie_titles() do
     query =
       from(
         m in Movie,

        :showtimes,
        mov.schedules
        |> map(fn showtime ->
          %{title: mov.title, cinemahall: "cineplex", imdb_id: mov.imdb_id, showtime: showtime}
        end)
      )
    end)
  end

  def get_new_movies(movies) do
    movies
    |> filter(&(!member?(get_saved_movie_titles(), &1.title)))
  end

  def get_new_showtimes(movies) do
    saved_movies =
      movies
      |> filter(&member?(get_saved_movie_titles(), &1.title))

    # list of showtimes from the provided movies
    fetched_showtimes = saved_movies |> map(fn m -> m.showtimes end) |> List.flatten()
    # fetch showtimes from db and checks if there are

    Repo.all(query)
  end

  @spec get_saved_movie_showtimes_by_title([String.t()]) :: [
          %{title: String.t(), showtime: String.t(), cinemahall: String.t()}
        ]
  defp get_saved_movie_showtimes_by_title(titles) do
    query =
      from(
        s in Showtime,
