Actually added target_dim as input