a more general approach