newl function made more generic