cleaned dirs, added t_i gen logic