diff --git a/input_profile_processor/calc_irradiance.py b/input_profile_processor/calc_irradiance.py
index e127c030f614b560e6f0f0dcb7deaeb6731f60ba..4e8fd9eb02dd492d687c37eb025250ff7ce7d754 100644
--- a/input_profile_processor/calc_irradiance.py
+++ b/input_profile_processor/calc_irradiance.py
@@ -26,27 +26,7 @@ import numpy as np
 import pandas as pd
 from datetime import timedelta
 
-
-def set_dates(t_start, t_horizon, t_step):
-    """
-        The method XYZ adds ...
-        :param
-        XYZ:
-        :returns
-        XYZ
-    """
-
-    time_steps = []
-    for t in pd.date_range(pd.Timestamp(t_start), pd.Timestamp(t_start) +
-                                              timedelta(hours=t_horizon) -
-                                              timedelta(hours=t_step),
-                           freq=str(t_step) + 'H'):
-        time_steps.append(t)
-    return time_steps
-
-
-def calc_total_irradiance(irradiance, timer, beta, psi_f, phi, lambda_st, lambda_1, alpha_albedo=0.2, reflection=1,
-                          refraction_index=2):
+def calc_total_irradiance(irradiance, timer, beta, psi_f, phi, lambda_st, lambda_1, alpha_albedo=0.2, reflection=1, refraction_index=2):
     """
     check value: alpha_albedo: ground reflectivity
     Reflection = 1?
@@ -138,22 +118,10 @@ def calc_total_irradiance(irradiance, timer, beta, psi_f, phi, lambda_st, lambda
     g_total = g_diffuse + g_reflected + g_beam
     return g_total
 
-
 def generate_g_t_series(irradiance, beta, psi_f, phi, lambda_st, lambda_1, t_start, t_horizon, t_step):
-    """
-        The method XYZ adds ...
-        :param
-        XYZ:
-        :returns
-        XYZ
-    """
-
-    T = set_dates(t_start, t_horizon, t_step)
+    T = list(pd.date_range(pd.Timestamp(t_start), pd.Timestamp(t_start) + timedelta(hours=t_horizon * t_step - t_step), freq=str(t_step) + 'H'))
     g_total_lst = []
-
-    for itr in range(len(T)):
-        timer = T[itr]
-        g_total = calc_total_irradiance(irradiance.loc[timer], timer, beta, psi_f, phi, lambda_st, lambda_1)
-        g_total_lst.append(g_total)
+    for t in T:
+        g_total_lst.append(calc_total_irradiance(irradiance.loc[t], t, beta, psi_f, phi, lambda_st, lambda_1))
 
     return pd.Series(data=g_total_lst, index=T)
diff --git a/input_profile_processor/input_profile_processor.py b/input_profile_processor/input_profile_processor.py
index 66ad5b8b0b482ae500d061711f457357aba9cf1d..273577458bde811bfaf0c3222856ff5a7204fb6a 100644
--- a/input_profile_processor/input_profile_processor.py
+++ b/input_profile_processor/input_profile_processor.py
@@ -63,7 +63,7 @@ def process_input_profiles(input_profile_dict, t_start, t_horizon, t_step):
 
 
 def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizon, t_step):
-    t_last = t_start + pd.Timedelta(hours = (t_horizon - 1) * t_step)
+    t_last = t_start + pd.Timedelta(hours = t_horizon * t_step - t_step)
     years = range(t_start.year, t_last.year + 1)
 
     if profile_type == 'elec_demand':